<template>
  <div class="slider">
    <el-row>
      <el-col :span="24">
        <h3 class="logo"><router-link to="/">小U商城后台</router-link></h3>
        <!-- router：开启路由模式，可以跳转 -->
        <!-- default-active：默认展开哪一项 -->
        <!-- index：将要跳转的路径，类似router-link的to属性 -->
        <el-menu
          :router="true"
          unique-opened
          default-active="$route.path"
          class="el-menu-vertical-demo"
          background-color="#262a32"
          text-color="rgb(204, 204, 204)"
          active-text-color="#ffd04b"
        >
          <el-menu-item index="/">
            <i class="el-icon-menu"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <el-submenu
            v-for="(item, index) in menuList"
            :key="index"
            :index="'top-' + index"
          >
            <template slot="title">
              <i :class="item.icon"></i>
              <span>{{ item.title }}</span>
            </template>
            <el-menu-item
              v-for="(menu, num) in item.children"
              :key="'menu' + num"
              :index="menu.url"
              >{{ menu.title }}</el-menu-item
            >
          </el-submenu>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  computed: {
    ...mapGetters(["menuList"]),
  },
  methods: {},
};
</script>

<style>
.el-menu-vertical-demo {
  text-align: left;
}
.slider{
    height: 100vh;
    background-color: #262a32;
    overflow: hidden;
}
.slider .el-menu{
    border-right: 0;
}
.slider h3{
    line-height: 60px;
    text-align: center;
    font-size: 20px;
    color: #fff;
    background-color: #444;
    white-space: nowrap;
    overflow: hidden;
    font-weight: normal;
    letter-spacing: 3px;
}
.slider h3 a {
  color: #fff;
}
.slider .el-menu-item.is-active{
  background-color: #FB6D49!important;
  color: #fff!important;
}
.slider .el-submenu .el-menu-item{
  padding-left: 55px!important;
}
</style>